package com.d3works.apps.account.service.move;

import com.d3works.apps.account.db.Move;
import com.d3works.apps.account.db.MoveLine;
import com.d3works.auth.db.User;
import com.d3works.exception.D3worksException;

public interface MoveLineControlService {

  /**
   * Method that control if accountingAccount of line is a valid or not.
   *
   * @param line
   * @throws D3worksException if line is not valid.
   */
  void controlAccountingAccount(MoveLine line) throws D3worksException;

  void validateMoveLine(MoveLine moveLine) throws D3worksException;

  boolean isInvoiceTermReadonly(MoveLine moveLine, User user);

  boolean displayInvoiceTermWarningMessage(MoveLine moveLine);

  Move setMoveLineDates(Move move) throws D3worksException;

  Move setMoveLineOriginDates(Move move) throws D3worksException;

  /**
   * Method that controls if moveLine.account.company is the same moveLine.move.company
   *
   * @param moveLine
   * @throws D3worksException
   */
  void checkAccountCompany(MoveLine moveLine) throws D3worksException;

  /**
   * Method that controls if moveLine.account.company is the same as moveLine.move.company
   *
   * @param moveLine
   * @throws D3worksException
   */
  void checkJournalCompany(MoveLine moveLine) throws D3worksException;

  boolean canReconcile(MoveLine moveLine);

  void checkPartner(MoveLine moveLine) throws D3worksException;
}
